package com.wyzz.hr.action;

import java.util.Map;

import com.wyzz.hr.base.BaseAction;
import com.wyzz.hr.util.DatabaseSysConfigManager;
import com.wyzz.hr.util.SysConfigManager;

public class ConfigPerfmance extends BaseAction {

	public ConfigPerfmance() {
	}

	public String showPerfConfig() throws Exception {
		if (!hasAuth(961, new int[0])) {
			addErrorInfo("\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u65E0\u6743\u8FDB\u5165\u8BE5\u9875\u9762\uFF01");
			return "noauth";
		} else {
			Map dbMap = dbManager.getProperties();
			sys_perf_plan_init = (String) dbMap.get("sys.perf.plan.init");
			sys_perf_plan_init = SystemConfigInit.getValue(sys_perf_plan_init,
					"0");
			sys_perf_plan_eval = (String) dbMap.get("sys.perf.plan.eval");
			sys_perf_plan_eval = SystemConfigInit.getValue(sys_perf_plan_eval,
					"0");
			sys_perf_data_cover = (String) dbMap.get("sys.perf.data.cover");
			sys_perf_data_cover = SystemConfigInit.getValue(
					sys_perf_data_cover, "0");
			sys_perf_hr_cover = (String) dbMap.get("sys.perf.hr.cover");
			sys_perf_hr_cover = SystemConfigInit.getValue(sys_perf_hr_cover,
					"0");
			return "success";
		}
	}

	public String updatePerfmanceConfig() throws Exception {
		if (!hasAuth(961, new int[0])) {
			addErrorInfo("\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u65E0\u6743\u8FDB\u5165\u8BE5\u9875\u9762\uFF01");
			return "noauth";
		} else {
			dbManager.setProperty("sys.perf.plan.init", sys_perf_plan_init);
			dbManager.setProperty("sys.perf.plan.eval", sys_perf_plan_eval);
			dbManager.setProperty("sys.perf.data.cover", sys_perf_data_cover);
			dbManager.setProperty("sys.perf.hr.cover", sys_perf_hr_cover);
			return "success";
		}
	}

	public String getSys_perf_plan_init() {
		return sys_perf_plan_init;
	}

	public void setSys_perf_plan_init(String sys_perf_plan_init) {
		this.sys_perf_plan_init = sys_perf_plan_init;
	}

	public String getSys_perf_plan_eval() {
		return sys_perf_plan_eval;
	}

	public void setSys_perf_plan_eval(String sys_perf_plan_eval) {
		this.sys_perf_plan_eval = sys_perf_plan_eval;
	}

	public String getSys_perf_data_cover() {
		return sys_perf_data_cover;
	}

	public void setSys_perf_data_cover(String sys_perf_data_cover) {
		this.sys_perf_data_cover = sys_perf_data_cover;
	}

	public String getSys_perf_hr_cover() {
		return sys_perf_hr_cover;
	}

	public void setSys_perf_hr_cover(String sys_perf_hr_cover) {
		this.sys_perf_hr_cover = sys_perf_hr_cover;
	}

	private static final long serialVersionUID = 1L;
	private String sys_perf_plan_init;
	private String sys_perf_plan_eval;
	private String sys_perf_data_cover;
	private String sys_perf_hr_cover;
	private static SysConfigManager dbManager = DatabaseSysConfigManager
			.getInstance();

}
